from vquant.analyzer import Analyzer
from vquant.broker import BackBroker
from vquant.datafeed import DataFeed
from vquant.strategy import Strategy


class Cerebro(object):
    def __init__(self):
        self.analyzer = Analyzer(self)
        self.broker = BackBroker(self)
        self.datafeed = DataFeed(self)
        self.strategy = Strategy(self)

    def on_tick(self, dataframe):
        self.broker.on_replace_position(dataframe)
        self.strategy.on_next(dataframe)

    def start(self):
        self.datafeed.start()


__all__ = [Cerebro]
